package cn.amaake.magicplugin.rpc.model;

import org.ssssssss.magicapi.core.model.MagicEntity;
import org.ssssssss.magicapi.core.model.PathMagicEntity;

import java.util.List;
import java.util.Objects;

public class RpcInfo extends PathMagicEntity {


    /**
     * 是否启用
     */
    private boolean enabled;

    private List<RpcParamData> paramData;


    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    public List<RpcParamData> getParamData() {
        return paramData;
    }

    public void setParamData(List<RpcParamData> paramData) {
        this.paramData = paramData;
    }

    public RpcInfo copy() {
        RpcInfo info = new RpcInfo();
        super.copyTo(info);
        info.setEnabled(this.enabled);
        info.setParamData(this.paramData);
        return info;
    }

    @Override
    public MagicEntity simple() {
        RpcInfo info = new RpcInfo();
        super.simple(info);
        return info;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        RpcInfo taskInfo = (RpcInfo) o;
        return Objects.equals(id, taskInfo.id) &&
                Objects.equals(path, taskInfo.path) &&
                Objects.equals(script, taskInfo.script) &&
                Objects.equals(name, taskInfo.name) &&
                Objects.equals(enabled, taskInfo.enabled);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, path, script, name, groupId, enabled);
    }
}
